package org.card.service.impl;

import org.card.bean.User;
import org.card.dao.UserDao;
import org.card.query.UserQuery;
import org.card.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by card on 16/3/4.
 */
@Service
public class UserServiceImpl implements UserService{

    @Resource
    private UserDao userDao;

    public User findByUsername(String username) {
        UserQuery userQuery = new UserQuery();
        userQuery.setUsername(username);
        List<User> users = userDao.selectList(userQuery);
        if(users.size() > 0) {
            return users.get(0);
        }
        return null;
    }
}
